home *** CD-ROM | disk | FTP | other *** search
- function Tween(mc, property, end, duration)
- {
- this.duration = duration;
- this.target = end;
- this.start = mc[property];
- this.mc = mc;
- this.property = property;
- }
- function setTweens()
- {
- var aa1 = 400;
- var aa3 = random(maxDir) + aa1;
- var aa2 = random(maxDir) + aa1;
- xtween = new Tween(oppbossa1,"_x",random(300),aa3);
- ytween = new Tween(oppbossa1,"_y",random(400),aa2);
- xtween.onEnd = function()
- {
- setTweens();
- };
- }
- Tween.prototype.step = function()
- {
- if(!this.dontAnimate)
- {
- }
- if(this.startTime == null)
- {
- this.startTime = getTimer();
- }
- var aa3 = getTimer() - this.startTime;
- var aa2 = aa3 / this.duration;
- aa2 = aa2 * aa2 * (3 - 2 * aa2);
- this.mc[this.property] = this.start + (this.target - this.start) * aa2;
- if(aa3 >= this.duration)
- {
- this.onEnd();
- this.dontAnimate = true;
- }
- };
- onEnterFrame = function()
- {
- xtween.step();
- ytween.step();
- if(plyWithin == true && ply.thisEnergy > 0)
- {
- mouseX = _xmouse;
- mouseY = _ymouse;
- }
- plyX = ply._x;
- plyY = ply._y;
- differenceX = mouseX - plyX;
- differenceY = mouseY - plyY;
- if(Math.abs(differenceX) > 1 && Math.abs(differenceY) > 1)
- {
- plyWalk = true;
- ply._x += differenceX / plySpeed;
- ply._y = ply._Y + differenceY / plySpeed;
- }
- else
- {
- plyWalk = false;
- }
- };
- setTweens();
- startAnim.gotoAndPlay("start");
- stop();
-